package com.vipshop.compass.config;

import java.util.Properties;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer;

/**
 * This class is a custom PropertyPlaceholderConfigurer which is used to load
 * the XML file and replace the placeholder in the spring configuration file.
 * 
 * @author Levin Cai
 * 
 */
public class CustomXMLPropertyPlaceholderConfigurer extends PropertyPlaceholderConfigurer {

	public CustomXMLPropertyPlaceholderConfigurer() {
		super();
	}

	@Override
	protected void processProperties(ConfigurableListableBeanFactory beanFactoryToProcess, Properties props) throws BeansException {
		Properties loadedProps = Globals.getInstance().getAllProperties();

		super.processProperties(beanFactoryToProcess, loadedProps);
	}

}
